home *** CD-ROM | disk | FTP | other *** search
- Path: uni-erlangen.de!winx03!sunshine!lemmi
- From: lemmi@informatik.uni-wuerzburg.de (Martin Lehmann)
- Newsgroups: comp.lang.c
- Subject: HELP : getkey
- Date: 6 Feb 1996 08:49:32 GMT
- Organization: University of Wuerzburg, Germany
- Message-ID: <4f74ms$hll@winx03.informatik.uni-wuerzburg.de>
- NNTP-Posting-Host: wi2x01.informatik.uni-wuerzburg.de
- X-Newsreader: TIN [version 1.2 PL2]
-
-
-
- --
- Hello !
-
- How do I make it to wait for a key pressed on the console (GNU C) ?
- I tried the following thing (using the CURSES-Libraray):
-
- char key;
-
- key = getch();
-
- This has the disadvantage, that the program is waiting for a key EXCLUSIVELY
- and nothing else can be done. What I want is to REACT on keys pressed within
- a bigger loop. I do not want to wait for the user having pressed a key; the
- program should continue :
-
- char key;
- while (no key pressed up to now && loop not ready)
- {
- if (keypressed)
- {
- key=getch();
- switch (key)
- {
- ...
- }
- }
- else
- {
- do the things of the big loop ...
- }
- }
-
-
- Has anyone an idea ?
- Thanx and CU, Martin
- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- = Martin Lehmann _/_/ _/_/ lemmi@informatik.uni-wuerzburg.de =
- = Basillastrasse 9 _/ _/ _/ _/ =
- = 97506 Grafenrheinfeld _/ _/ _/ Corollar to Murphy's Laws: =
- = 09723 / 4486 _/ _/_/_/_/ Murphy was an optimist ! =
- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-